Kanzi 3.9.10
DataSource Class Reference

Use data sources to separate the user interface from the application data and to remove the dependencies between a Kanzi Studio project and the application code which define the Kanzi application. More...

Inheritance diagram for DataSource:
[legend]

Public Member Functions

void close ()
 Close the object, and release native resources.
 
DataObject getData ()
 Retrieves the root object of the underlying data tree.
 
DataContext lookupDataContext (String relativePath)
 Performs object look-up by path.
 
- Public Member Functions inherited from DataContext
ModifiedSubscriptionToken addModifiedNotificationHandler (ModifiedSubscriptionFunction modifiedHandlerFunction)
 Allows to subscribe to modifications in this data context.
 
void notifyModified ()
 Triggers modification procedure in this data context, which invokes the subscriptions.
 
void removeModifiedNotificationHandler (DataContext.ModifiedSubscriptionToken token)
 Removes a modification subscription.
 
- Public Member Functions inherited from Resource
String getName ()
 Gets the resource name.
 
String getUrl ()
 Gets the resource URL.
 
void setKeepAlive (boolean keepAlive)
 Sets the keep alive flag.
 
- Public Member Functions inherited from KanziObject
boolean equals (Object object)
 
Domain getDomain ()
 Returns the domain the object belongs to.
 
Metaclass getDynamicMetaclass ()
 Returns the metaclass of the dynamic type of the object.
 
long getNative ()
 Gets a pointer to the backing C++ instance.
 
TDataType getOptionalProperty (PropertyType< TDataType > propertyType)
 Returns the current value of a property type, but does not use the default value if there are no inputs to the property value.
 
TDataType getProperty (PropertyType< TDataType > propertyType)
 Returns the current value of a property type.
 
int hashCode ()
 
boolean hasValue (PropertyType< TDataType > propertyType)
 Evaluates whether there are any inputs into the property value.
 
boolean isStale ()
 Test if the object is stale i.e.
 
void removeLocalValue (PropertyType< TDataType > propertyType)
 Removes the local value associated with the property.
 
void setProperty (PropertyType< TDataType > propertyType, TDataType value)
 Sets the local value of a property type.
 
ObjectRef< TTypetryCreateObjectRef (Class< TType > clazz)
 Tries to create an owning ObjectRef instance to this KanziObject.
 

Static Public Attributes

static final Metaclass metaclass
 The Metaclass for the class.
 
- Static Public Attributes inherited from DataContext
static final Metaclass metaclass
 The Metaclass for the class.
 
- Static Public Attributes inherited from Resource
static final Metaclass metaclass
 The Metaclass for the class.
 
- Static Public Attributes inherited from KanziObject
static final Metaclass metaclass = new AbstractMetaclass("Kanzi.Object")
 The Metaclass for the class.
 

Protected Member Functions

 DataSource (Domain domain, long nativeObject, Metaclass metaclass)
 Wraps a given native DataSource Called by KanziObject.connectResource(long) when connecting to a native DataSource.
 
void initialize ()
 Initializes the DataSource.
 
void onLoaded ()
 Override function called after loadFromKZB.
 

Static Protected Member Functions

static< Derived extends DataSource > ObjectRef< DerivedcreateDerived (Domain domain, String name, Metaclass metaclass)
 Creates a derived class instance.
 

Additional Inherited Members

- Public Attributes inherited from ResourceMetadata
AbstractMetaclass metaclass = new AbstractMetaclass("Kanzi.Resource")
 Metaclass for Resource.
 
- Public Attributes inherited from DataContextMetadata
DynamicPropertyType< ResourceDataContextProperty
 Source of data for this node and its descendants.
 
DynamicPropertyType< ResourceItemsSourceProperty
 Data object which provides data sources for list items.
 
AbstractMetaclass metaclass = new AbstractMetaclass("Kanzi.DataContext")
 Metaclass for DataContext.
 
- Public Attributes inherited from DataSourceMetadata
AbstractMetaclass metaclass = new AbstractMetaclass("Kanzi.DataSource")
 Metaclass for DataSource.
 

Detailed Description

Use data sources to separate the user interface from the application data and to remove the dependencies between a Kanzi Studio project and the application code which define the Kanzi application.

Kanzi allows you to define the format and structure of your data source by defining a Kanzi Engine data source plugin.

When you use a data source in a Kanzi application you bind the values of properties and property fields to data that comes from a data source. This binding establishes a connection between a node or a resource and the application data. When data in the data source changes, the nodes and resources which are bound to the data reflect the change in the data.

To set a node to use a data source, use the DataContext.DataContext property. When you set the Data Context property for a node, all its child nodes inherit the value of the Data Context property. After you set a node to use a data source, you can use bindings to access the data.

Constructor & Destructor Documentation

◆ DataSource()

DataSource ( Domain domain,
long nativeObject,
Metaclass metaclass )
protected

Wraps a given native DataSource Called by KanziObject.connectResource(long) when connecting to a native DataSource.

Parameters
domainUI Domain where this DataSource belongs
nativeObjectNative object that is backing this DataSource
metaclassMetaclass data for this DataSource

Member Function Documentation

◆ createDerived()

static< Derived extends DataSource > ObjectRef< Derived > createDerived ( Domain domain,
String name,
Metaclass metaclass )
staticprotected

Creates a derived class instance.

Call this method as part of the create method for a derived class.

Parameters
domainUI Domain where this data source belongs.
nameName of the data source
metaclassMetaclass data of the data source.
Returns
An ObjectRef that holds the created instance.

◆ getData()

DataObject getData ( )

Retrieves the root object of the underlying data tree.

Returns
Returns data object that is the root of the data tree.

Reimplemented from DataContext.

◆ lookupDataContext()

DataContext lookupDataContext ( String relativePath)

Performs object look-up by path.

Parameters
relativePathPath of the object where to look at, separated by '.'.
Returns
Data object that was found, or empty pointer if there was no such object.

Reimplemented from DataContext.

Member Data Documentation

◆ metaclass

final Metaclass metaclass
static
Initial value:
=
com.rightware.kanzi.metadata.DataSourceMetadata.metaclass

The Metaclass for the class.